home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / Graphic Elements 3 / LibHdrs / GraphElements.h < prev    next >
Text File  |  1995-05-25  |  5KB  |  152 lines

  1. /*
  2.     GraphElements.h
  3.     
  4.     Basic Graphic Elements for version 3.0
  5.     
  6.     Copyright 1994 by Al Evans. All rights reserved.
  7.     
  8.     12/8/93
  9.     
  10.     checked 5/25/95
  11. */
  12.  
  13. #ifndef GRAPHELEMENTS
  14. #define GRAPHELEMENTS
  15.  
  16. #include "DispCtrl.h"
  17. #include "FastBitCopies.h"
  18.  
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22.  
  23. //-------------------------------------------------------------------------------------
  24. //Simple PICT-based Graphic Element
  25. //-------------------------------------------------------------------------------------
  26.  
  27. GrafElPtr NewBasicPICT(GEWorldPtr world, OSType id, short plane, short resNum,
  28.                             short mode, short xPos, short yPos);
  29.                             
  30. //Render proc for basic PICT graphic
  31. pascal void PICTRenderProc(GrafElPtr element, GWorldPtr destGWorld);
  32.  
  33. //-------------------------------------------------------------------------------------
  34. //Scrolling Graphic Element
  35. //-------------------------------------------------------------------------------------
  36.  
  37. typedef struct {
  38.     GrafElement        baseGraphic;
  39.     short            hScroll;            //horiz scroll for each changeIntrvl
  40.     short            vScroll;            //vert scroll for each changeIntrvl    
  41.     short            totalHScroll;        //total current horizontal scroll
  42.     short            totalVScroll;        //total current vertical scroll
  43. } ScrollingGraphic, *ScrlGraphicPtr;
  44.  
  45. //Creation of PICT-based scrolling graphics
  46. GrafElPtr NewScrollingGraphic(GEWorldPtr world, OSType id, short plane, 
  47.                         short resNum, short mode, short xPos, short yPos);
  48.  
  49. //Start or stop (autoHScroll == autoVScroll == 0) auto-scrolling
  50. void AutoScrollGraphic(GEWorldPtr world, OSType elementID, 
  51.                     short interval, short autoHScroll, short autoVScroll);
  52.                     
  53. //Manually set current scroll position
  54. void SetScroll(GEWorldPtr world, OSType elementID, short hScroll, short vScroll);
  55.  
  56. //RenderProc for scrolling graphics
  57. pascal void RenderScrollingGraphic(GrafElPtr graphic, GWorldPtr destGWorld);
  58.  
  59. //AutoChangeProc for scrolling graphics
  60. pascal void ScrollGraphic(GEWorldPtr world, GrafElPtr graphic);
  61.  
  62. //-------------------------------------------------------------------------------------
  63. //Animated (frame-sequence) Graphic Element
  64. //-------------------------------------------------------------------------------------
  65.  
  66. typedef enum {    singleframe=0, 
  67.                 reciprocating, 
  68.                 loop, 
  69.                 oneshotvanish, 
  70.                 oneshotstop, 
  71.                 oneshotloop} AnimSequence;
  72.  
  73. typedef struct {
  74.     GrafElement    baseGraphic;
  75.     short            currentFrame;        // number of frame now displayed
  76.     short            nFrames;            // number of frames available
  77.     AnimSequence    seq;                // type of animation
  78. } FrameSeqGraphic, *SeqGraphicPtr;
  79.  
  80.  
  81. //Creation of PICT-based multiframe graphics
  82. GrafElPtr NewAnimatedGraphic(GEWorldPtr world, OSType id, short plane, 
  83.                     short resNum, short mode, short xPos, short yPos, short nFrames);
  84.                     
  85. //Activate or deactivate (interval == 0) automatic animation 
  86. void AnimateGraphic(GEWorldPtr world, OSType elementID, 
  87.                     short interval, AnimSequence sequence);
  88.  
  89. //Manually set current frame                    
  90. void SetFrame(GEWorldPtr world, OSType elementID, short newFrame);
  91.  
  92. //Frame sequence forwards or backwards
  93. void SetAnimDirection(GEWorldPtr world, OSType elementID, Boolean forward);
  94.  
  95. //Increment or decrement current frame according to frame sequence
  96. void BumpFrame(GEWorldPtr world, OSType elementID);
  97.  
  98. //Alternate interface to BumpFrame: avoid lookup when GrafElPtr available.
  99. //Also used as AutoChangeProc for frame-based graphics
  100. pascal void PtrBumpFrame(GEWorldPtr world, GrafElPtr graphic);
  101.  
  102. //Set horizontal or vertical mirroring
  103. //NOTE!! Only works for transparent FrameSeqGraphics using default BitCopyProc
  104. //and srcCopy FrameSeqGraphics which have been masked with MakeMask() (see FastBitCopies.h)
  105. void SetMirroring(GEWorldPtr world, OSType elementID, Boolean mirrorH, Boolean mirrorV);
  106.  
  107. //RenderProc for frame-changing graphics
  108. pascal void RenderFrameGraphic(GrafElPtr graphic, GWorldPtr destGWorld);
  109.  
  110.  
  111. //-------------------------------------------------------------------------------------
  112. //Simple one-line text graphic
  113. //-------------------------------------------------------------------------------------
  114.  
  115. typedef struct {
  116.     GrafElement        baseGraphic;
  117.     StringPtr        tgText;                //pointer to text
  118.     FontInfo        tgFInfo;            //FontInfo rec for text
  119.     short            tgFontNum;            //etc.
  120.     short            tgFontSize;
  121.     short            tgFontFace;
  122.     RGBColor        tgColor;            //Color for text
  123. } TextGraphic, *TextGraphicPtr;
  124.  
  125. //Create new text graphic
  126. GrafElPtr NewTextGraphic(GEWorldPtr world, OSType id, short plane,
  127.                     short xPos, short yPos, short mode,
  128.                     short fontNum, short txStyle, short size, 
  129.                     RGBColor color, StringPtr text);
  130.  
  131. //Change text of existing text graphic
  132. void SetTextGraphicText(GEWorldPtr world, OSType elementID, StringPtr newText);
  133.  
  134. //RenderProc for text graphics
  135. pascal void RenderTextGraphic(GrafElPtr graphic, GWorldPtr destGWorld);
  136.  
  137. //-------------------------------------------------------------------------------------
  138. //This Graphic Element tiles a single PICT into its (larger) animationRect
  139. //-------------------------------------------------------------------------------------
  140.  
  141. GrafElPtr NewTiledGraphic(GEWorldPtr world, OSType id, short plane, 
  142.                         short resNum, short mode, Rect destRect);
  143.                         
  144. //RenderProc for tiled graphics
  145. pascal void RenderTiledGraphic(GrafElPtr graphic, GWorldPtr destGWorld);
  146.  
  147. #ifdef __cplusplus
  148. }
  149. #endif
  150.  
  151.  
  152. #endif